package com.jie.jie;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.jaydenxiao.common.v.dialog.CommonDialogTwoBtn;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DialogToastActivity extends AppCompatActivity {

    @Bind(R.id.dialog)
    Button dialog;
    @Bind(R.id.toast)
    Button toast;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog_toast);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.dialog, R.id.toast})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.dialog:
                CommonDialogTwoBtn btn = new CommonDialogTwoBtn.Builder(this)
                        .setMessage("sss")
                        .setNegativeButton("aaaa", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Toast.makeText(DialogToastActivity.this, "hshshshshhs", Toast.LENGTH_SHORT).show();
                            }
                        })
                        .setPositiveButton("bbbb", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Toast.makeText(MyApplication.getInstance(), "application", Toast.LENGTH_SHORT).show();
                            }
                        }).create();
                btn.show();

//                AlertDialog dialog = new AlertDialog.Builder(this)
//                        .setTitle("hahahaha")
//                        .setNegativeButton("activity", new DialogInterface.OnClickListener() {
//                            @Override
//                            public void onClick(DialogInterface dialog, int which) {
//                                Toast.makeText(DialogToastActivity.this, "hshshshshhs", Toast.LENGTH_SHORT).show();
//                            }
//                        })
//                        .setCancelable(false)
//                        .setPositiveButton("application", new DialogInterface.OnClickListener() {
//                            @Override
//                            public void onClick(DialogInterface dialog, int which) {
//                                Toast.makeText(MyApplication.getInstance(), "application", Toast.LENGTH_SHORT).show();
//                            }
//                        })
//                        .create();
//                dialog.show();
                break;
            case R.id.toast:
                Toast.makeText(this, "直接弹", Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
